package com.itheima.reggie.controller;

import com.itheima.reggie.common.ResultInfo;
import com.itheima.reggie.domain.Dish;
import com.itheima.reggie.domain.Setmeal;
import com.itheima.reggie.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class SetmealController {
    //注入service
    @Autowired
    private SetmealService setmealService;
    //套餐展示
    @GetMapping("/setmeal/list")
    public ResultInfo findList(Long categoryId ,Integer status){ //接收请求
    //调用service查询
   List<Setmeal> setmealList =  setmealService.findList(categoryId,status);
   //返回结果
        return ResultInfo.success(setmealList);
    }
    //套餐菜品图片
    @GetMapping("/setmeal/dish/{id}")
    public ResultInfo dishId(@PathVariable Long id){ //接收请求
    //调用service
        List<Dish> list = setmealService.getmealDish(id);
        return ResultInfo.success(list);
    }

}
